]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenShield: Only release logind inhibitor on suspend
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 14 Mar 2013 15:37:40 +0000 (16:37 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 14 Mar 2013 18:09:15 +0000 (19:09 +0100)
To make sure that the screen shield is shown before suspending, we
take a logind inhibitor and release it when the screen shield is
shown. As the screen shield is not only shown on suspend, we can end
up releasing the inhibitor independently from suspending (lock, idle),
in which case the screen might not be locked when we do suspend.
To fix, only release the inhibitor after showing the screen shield
when we are about to suspend.

https://bugzilla.gnome.org/show_bug.cgi?id=693708

js/ui/screenShield.js

index f2a1ceac7662a80c324ca982b734bbd7b2c5fc91..3c8dd6ea0e33dd229baf552d0017855c4bb0a3b9 100644 (file)
@@ -502,6 +502,7 @@ const ScreenShield = new Lang.Class({
         this._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this);
 
         this._inhibitor = null;
+        this._aboutToSuspend = false;
         this._loginManager = LoginManager.getLoginManager();
         this._loginManager.connect('prepare-for-sleep',
                                    Lang.bind(this, this._prepareForSleep));
@@ -644,6 +645,8 @@ const ScreenShield = new Lang.Class({
     },
 
     _prepareForSleep: function(loginManager, aboutToSuspend) {
+        this._aboutToSuspend = aboutToSuspend;
+
         if (aboutToSuspend) {
             if (!this._settings.get_boolean(LOCK_ENABLED_KEY)) {
                 this._uninhibitSuspend();
@@ -999,7 +1002,8 @@ const ScreenShield = new Lang.Class({
         if (prevIsActive != this._isActive)
             this.emit('active-changed');
 
-        this._uninhibitSuspend();
+        if (this._aboutToSuspend)
+            this._uninhibitSuspend();
 
         this.emit('lock-screen-shown');
     },